﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;

namespace DALTestSuite
{
    class Program
    {

        Program()
        {
            bool[] d = dal.DataObject.Blog.Get().Select(l => l.delete()).ToArray();
            bool[] e = dal.DataObject.Post.Get().Select(l => l.delete()).ToArray();
            bool[] f = dal.DataObject.ExternalData.Get().Select(l => l.delete()).ToArray();


            for (int x = 0; x < 100; x++)
            {
                dal.DataObject.Post post = new dal.DataObject.Post();
                post.Title= post.Body = "gary" + x;
                post.Postdate = new DateTime(1970, 1, 2);
                //post.ExternalStuff = new dal.DataObject.ExternalData() { Title = "dogs" };
                //post.ExternalStuff.Save();
                post.Save();
            }

           // if ( dal.DataObject.Post.Get().Length != 100 ) Console.WriteLine("POST LENGTH ERROR" );

            if (dal.DataObject.Post.Get_Postdate(new DateTime(1970, 1, 2)).Length != 100) Console.WriteLine("DATE LENGTH ERROR");
            if (dal.DataObject.Post.Get_Title("gary55").Length != 1) Console.WriteLine("TITLE LENGTH ERROR");
            //if (!dal.DataObject.Post.Get_Title("gary33")[0].ExternalStuff.Title.Equals("dogs"))Console.WriteLine("EXTERNAL DATA ERROR");
        }



        static void Main(string[] args)
        {
            for (int x = 0; x < 10; x++)
            {
                DateTime start = DateTime.Now;
                new Program();
                Console.WriteLine((DateTime.Now - start).TotalMilliseconds.ToString());
            }
        }
    }
}
